package com.lifa.controller;

import com.lifa.dao.HouseInfoDao;
import com.lifa.pojo.HouseDianpuBean;
import com.lifa.pojo.HouseHuTypeBean;
import com.lifa.pojo.HouseHuiYuanBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/house")
@Scope("prototype")
public class HouseInfoController {
    @Autowired
    private HouseInfoDao houseInfoDao;


    @RequestMapping("/queryGroupType")
    @ResponseBody
    public Map<String,List<HouseDianpuBean>> queryGroupType(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        List<HouseDianpuBean> list = houseInfoDao.queryGroupDianPu();
        Map<String,List<HouseDianpuBean>> map = new HashMap<>() ;
        map.put("t",list) ;
        return map ;
    }


    @RequestMapping("/queryGroupHuTypeBean")
    @ResponseBody
    public List<HouseHuTypeBean> queryGroupHuTypeBean(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        List<HouseHuTypeBean> list = houseInfoDao.queryGroupFuWu();

        return list ;
    }



    @RequestMapping("/queryGroupHuiYuanType")
    @ResponseBody
    public Map<String, List<HouseHuiYuanBean>> queryGroupHuiYuanType(){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        List<HouseHuiYuanBean> list = houseInfoDao.queryGroupHuiYuan();
        Map<String,List<HouseHuiYuanBean>> map = new HashMap<>() ;
        map.put("t",list) ;
        return map ;
    }
}
